package com.symbio.ishenapi.doctor.controller;

import com.symbio.ishenapi.common.bean.LoginUser;
import com.symbio.ishenapi.common.controller.BaseController;
import com.symbio.ishenapi.doctor.model.TmGroupMessage;
import io.jboot.web.controller.annotation.RequestMapping;

/**
 * @Author: chen
 * @Description:群消息控制层
 * @Date: Created in 15:50 2018/12/3
 * @Modified By:
 */
@RequestMapping("/TmGroupMessage")
public class TmGroupMessageController extends BaseController{

    /** POST
     * @Author: chen
     * @Description:群消息发送
     * @Date: 15:56 2018/12/3
     * @param: [
     *              "groupId":"群id",
     *               "content":"消息内容",
     *               "userIds":"接受用户的ids"
     *          ]
     * @return: void  
     */
    public void save(){
        try {
            TmGroupMessage tmGroupMessage = (TmGroupMessage)getReqBodyObject(TmGroupMessage.class);
            LoginUser loginUser = getLoginUser();
            TmGroupMessage.dao.saveTmGroupMessage(tmGroupMessage,loginUser);
            renderJsonError(50001,"发送成功");
        }catch (Exception e){
            e.printStackTrace();
            renderJsonError(50002,"发送失败");
        }
    }


}
